package com.woniuxy.usecredit.service.impl;/* *
@author author
@create 2021-11-15 20:53
*/

import com.woniuxy.entity.EnterpriseCreditUsed;
import com.woniuxy.usecredit.mapper.EnterpriseCreditUsedMapper;
import com.woniuxy.usecredit.service.EnterpriseCreditUsedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EnterpriseCreditUsedServiceImpl implements EnterpriseCreditUsedService {

    @Autowired
    EnterpriseCreditUsedMapper enterpriseCreditUsedMapper;

    @Override
    public void addCreditUsed(EnterpriseCreditUsed enterpriseCreditUsed) {
        enterpriseCreditUsedMapper.insertCreditUsed(enterpriseCreditUsed);
    }

    @Override
    public List<EnterpriseCreditUsed> selectCreditUsedByCreditId(int creditId) {
        return enterpriseCreditUsedMapper.selectCreditUsedByCreditId(creditId);
    }

    @Override
    public List<EnterpriseCreditUsed> selectAllCreditUseds() {
        return enterpriseCreditUsedMapper.selectAllCreditUseds();
    }

    @Override
    public boolean removeCreditUsedById(int id) {
        try{
            enterpriseCreditUsedMapper.deleteCreditUsedById(id);
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
        return true;
    }
}
